﻿
using System.Windows;
namespace OnTheWay.Models
{
    public class Page
    {
        int firstResult = 0;
        int maxResult = 0;
        bool isASC = true;
        string _order = "";

        public Page()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="index">页数（从0开始）</param>
        /// <param name="size">单页数量</param>
        public Page(int index, int size)
        {
            firstResult = index * size;
            maxResult = size;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="index">页数（从0开始）</param>
        /// <param name="size">单页数量</param>
        /// <param name="order">排序字段</param>
        /// <param name="desc">是否降序</param>
        public Page(int index, int size,string order,bool desc)
            : this(index,size)
        {
            this.Order = Order;
            this.IsASC = !desc;
        }

        public string Order
        {
            get { return _order; }
            set { if (value != null)_order = value; else _order = ""; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int FirstResult
        {
            get { return firstResult; }
            set { firstResult = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public int MaxResult
        {
            get { return maxResult; }
            set { maxResult = value; }
        }
        /// <summary>
        /// 是否是ASC排序，否则DESC排序
        /// </summary>
        public bool IsASC
        {
            get { return isASC; }
            set { isASC = value; }
        }
    }
}
